package com.docmanage.common.utils;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author yhd
 * @create 2024/3/7 16:29
 */
@Data
public class TreeNode <T> implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 节点ID
     */
    private Long id;

    /**
     * 父节点ID
     */
    private Long parentId;

    /**
     * 父节点
     */
    private T parent;

    /**
     * 子节点列表
     */
    private List<T> children = new ArrayList<>();

    public void add(T node) {
        children.add(node);
    }
}
